$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'edu/course/query',
        datatype: "json",
        colModel: [
            { label: 'ID', name: 'id',hidden: true, width: 10, key: true },
            { label: '课程编号', name: 'courseSno', width: 40 },
            { label: '课程名称', name: 'courseName', width: 80 },
            { label: '课程性质', name: 'courseNature', width: 40 },
            { label: '学分数', name: 'courseScore', width: 20 },

            { label: '学时数', name: 'courseTime', width: 20 },
            { label: '授课周数', name: 'courseWeek', width: 20 },
            { label: '学时(理)', name: 'courseTimeTheory', width: 20 },
            { label: '学时(实)', name: 'courseTimePractice', width: 20 } ,
            { label: '开设学期', name: 'semester', width: 20 } ,
            { label: '开设专业', name: 'specialty', width: 80 }
        ],
        viewrecords: true,
        height: 385,
        rowNum: 10,
        rowList : [10,30,50],
        rownumbers: true,
        rownumWidth: 25,
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page",
            rows:"limit",
            order: "order"
        },
        gridComplete:function(){
            //隐藏grid底部滚动条
            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
        }
    });
});

var vm = new Vue({
    el:'#rrapp',
    data:{
        showList: true,//div 的隐藏和显示

    },
    created:function(){

    },
    methods: {
        upload: function(){
            alert("未完待续。。。。")
        },
        query: function () {

            vm.reload();
        },

        reload: function (event) {
            vm.showList = true;
            var page = $("#jqGrid").jqGrid('getGridParam','page');
            page ="1";
            $("#jqGrid").jqGrid('setGridParam',{
                postData:{},
                page:page
            }).trigger("reloadGrid");
        }
    }
});